import QtQuick 1.0

Rectangle {
    id: pathController

    gradient: Gradient {
        GradientStop { position: 0.0; color: root.constants.highlightColorAccent }
        GradientStop { position: 1.0; color: root.constants.highlightColor }
    }

    Row {
        height: parent.height - root.constants.defaultMargin * 2
        anchors.fill: parent
        anchors.margins: {
            top: root.constants.defaultMargin
            right: root.constants.defaultMargin
            bottom: root.constants.defaultMargin
            left: root.constants.defaultMargin
        }
        spacing: root.constants.defaultLayoutSpacing

        // The text container for the current path.
        Item {
            width: parent.width - parent.height - root.constants.defaultLayoutSpacing
            height: parent.height

            Rectangle {
                id: shadowRectangle
                width: parent.width
                height: parent.height
                radius: height * root.constants.defaultRelativeRadius
                opacity: root.constants.shadowOpacity
                smooth: true

                gradient: Gradient {
                        GradientStop { position: 0.0; color: root.constants.defaultBackgroundColor }
                        GradientStop { position: 1.0; color: root.constants.defaultForegroundColor }
                }
            }

            Rectangle {
                width: shadowRectangle.width - root.constants.defaultBorderWidth * 2
                height: shadowRectangle.height - root.constants.defaultBorderWidth * 2
                anchors.centerIn: shadowRectangle
                radius: shadowRectangle.radius
                color: root.constants.defaultBackgroundColor
                smooth: true

                Text {
                    anchors.fill: parent
                    anchors.leftMargin: root.constants.defaultMargin / 2
                    anchors.rightMargin: root.constants.defaultMargin / 2
                    color: root.constants.defaultForegroundColor
                    verticalAlignment: Text.AlignVCenter
                    elide: Text.ElideMiddle
                    font.pixelSize: root.constants.defaultFontPixelSize
                    text: engine.sourcePath
                }
            }
        }

        // The button for moving up in the folder hierarchy.
        Button {
            width: parent.height
            height: parent.height
            state: "enabled"
            iconFilename: "folder_up_icon.png"

            onTapped: {
                // Jump to the parent folder.
                if (!engine.navigateToSourceParentFolder()) {
                    // Already at root? Display the source drive selection
                    // dialog if more than one internal drives exist.
                    driveModel.filterInternalDrivesOnly();

                    if (driveModel.rowCount > 1) {
                        driveSelectionDialog.source = true;
                        driveSelectionDialog.doDisplay();
                    }
                }
            }
        }
    }
}

// End of file.
